local matRefraction	= Material( "sprites/heatwave" )

local tMats = {}

tMats.Glow1 = Material("sprites/light_glow02")
tMats.Glow2 = Material("sprites/yellowflare")
tMats.Glow3 = Material("sprites/redglow2")

for _,mat in pairs(tMats) do

	mat:SetMaterialInt("$spriterendermode",9)
	mat:SetMaterialInt("$ignorez",1)
	mat:SetMaterialInt("$illumfactor",8)
	
end

/*---------------------------------------------------------
   Init( data table )
---------------------------------------------------------*/
function EFFECT:Init( data )

	self.Pos = data:GetOrigin()
	self.Pos.z = self.Pos.z + 4
	self.Size = 70
	self.Emitter = ParticleEmitter( self.Pos )
	
	for i=1,12 do
	
		local particle = self.Emitter:Add("particles/smokey", self.Pos )

		particle:SetVelocity(Vector(math.Rand(-150,150),math.Rand(-150,150),math.Rand(200,300)))
		particle:SetDieTime( math.Rand(1,1.5) )
		particle:SetStartAlpha( math.random( 50, 75 ) )
		particle:SetEndAlpha( 0 )
		particle:SetStartSize( math.Rand( 3, 10 ) )
		particle:SetEndSize( math.Rand( 60, 90 ) )
		particle:SetRoll( math.Rand( -180, 180 ) )
		particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
		particle:SetColor(40, 40, 40)
		
		local particle = self.Emitter:Add("effects/fleck_cement"..math.random(1,2), self.Pos )

		particle:SetVelocity(Vector(math.Rand(-190,190),math.Rand(-190,190),math.Rand(600,800)))
		particle:SetDieTime( math.Rand( 7,9 ) )
		particle:SetStartAlpha( math.random( 200, 225 ) )
		particle:SetEndAlpha( 0 )
		particle:SetStartSize( math.Rand( 2, 3 ) )
		particle:SetEndSize( math.Rand( 0, 1 ) )
		particle:SetRoll( math.Rand( -180, 180 ) )
		particle:SetRollDelta( math.Rand( -0.1, 0.1 ) )
		particle:SetColor(40, math.random(40,80), 40)
		particle:SetGravity(Vector(0,0,-500)) //-600 is normal
		particle:SetCollide(true)
		particle:SetBounce(0.3) 
		
	end
	
	self.Ang = Angle(0,0,0)
	for i=1, math.random(28,35) do
	
		self.Ang:RotateAroundAxis(self.Ang:Right(), (360/35))
		local forward = ((self.Ang+Angle(0,math.random(-40,40),math.random(-40,40)))):Forward()
		local particle = self.Emitter:Add( "effects/muzzleflash"..math.random(1,4), self.Pos  )

		particle:SetVelocity( forward * math.Rand(90,120) )
		particle:SetDieTime( math.Rand( .5, .8 ) )
		particle:SetStartAlpha( math.Rand( 120, 140 ) )
		particle:SetEndAlpha( 0 )
		particle:SetStartSize( math.Rand(1,20) )
		particle:SetEndSize( math.Rand( 220, 270 ) )
		particle:SetRoll( math.Rand( -180,180 ) )
		particle:SetRollDelta( math.Rand( -1, 1 ) )
		particle:SetColor( math.Rand( 150, 255 ), math.Rand( 100, 150 ), 100 )
		particle:VelocityDecay( true )	
				
	end
	self.Emitter:Finish()
end

/*---------------------------------------------------------
   THINK
---------------------------------------------------------*/
function EFFECT:Think( )
	return false	
end

/*---------------------------------------------------------
   Draw the effect
---------------------------------------------------------*/
function EFFECT:Render( )

end
